/*
 * jQuery  Plugin jQPOOOP v 0.0.9
 * http://www.dieroboter.com/jQPOOOP/
 *
 * Copyright (c) 2009 Esteban Martin Gimenez
 *http://www.dieroboter.com
 * Dual licensed under the MIT and GPL licenses.
 *
 * Date: 2009-08-12 20:42:16 
 * Revision: 9
 */
 
(function($) {

$.fn.popup = function(){
    this.each( function(){
			alert(this);
    });
}

$.fn.popup.options_default = {
		 Top:0,
		 Left:0,
		 Mensaje:"Ninguno",
		 Position:"absolute",
		 Ajax:"/plugin/popup.html",
		 Id:"Id",
		 Center:"true",
		 Width:400,
		 Height:250
	},

$.extend({

	'load': 
 		{
		'url': 'popup.html',
		'cache': false,
		'dataType': 'html',
		'type':'GET',
		success: function(msg)
		{
			$('"<div id="'+opc.Id+'">'+ msg +'</div>"').appendTo("body");	
			var w = window.innerWidth ||document.documentElement.clientWidth || document.body.clientWidth;
			var h = window.innerHeight ||document.documentElement.clientHeight || document.body.clientHeight;
			w1 =(w/2) - (opc.Width/2); 
			h1 =(h/2) - (opc.Height/2);
			$('#'+opc.Id).css("top",h1+"px");
			$('#'+opc.Id).css("left",w1+"px");
			$('#'+opc.Id).css("display","");
			$('#'+opc.Id).css("z-index","1000");
			$('#'+opc.Id).css("position","absolute");
		}
	}
});

$.popup=function(options_user)
	{

		opc = $.extend( $.fn.popup.options_default,options_user );
		if(jQuery('#'+opc.Id).length)
				return false;
	
		$.ajax(this.load);	
	},

$.close=function(options_user)
	{
		opc = $.extend( $.fn.popup.options_default,options_user );
		$('#'+opc.Id).remove();
	}

})(jQuery);
